# coding: utf-8
from django.http import HttpResponse
from invenio.search_engine import perform_request_search, print_record
import re
from invenio.config import CFG_SITE_URL
import random
import urllib

def search(request, psh):
	reclist = perform_request_search(p='"%s"' % urllib.quote(psh), f="PSH")
	titles = ""
	for rec in reclist:
		titles += "<a href='%s'>%s</a><br />" % ("%s/record/%d" % (CFG_SITE_URL, rec), print_record(rec, format='xt'))
		
	return HttpResponse(titles)
	#return HttpResponse(psh)
	
